import React from "react";
// 在无状态组件中使用redux如何更新；
import story from "../story";
import { setHomeNameAction, setHomeTimeAction } from "../story/actionCreators";
const Index = () => {
  // 1.获取值
  const { home } = story.getState();
  let handleSetName = () => {
    // 2.派发一个动作
    story.dispatch(setHomeNameAction("北京工商管理专修学院"));
   
  };
let handleSetTime=()=>{
  story.dispatch(setHomeTimeAction("200年"));
}
  return (
    <div>
      <h2>{home.name}</h2>
      <h2>{home.year}</h2>
      <button onClick={handleSetName}>修改名称</button>
      <button onClick={handleSetTime}>修改年龄</button>
    </div>
  );
};

export default Index;
